package com.link_with_health.common;

import com.link_with_health.model.PatientEntity;
import com.link_with_health.model.UserEntity;

import java.util.List;
import java.util.stream.Collectors;

public class VerifyUserUtil {
    private static Integer[] VALID_USER_STATUS = new Integer[]{1,2,3};

    public static boolean verifyUserStatus(Integer status){
        if(status != null)
            for(int flag:VALID_USER_STATUS){
                if(flag == status)
                    return true;
            }
        return false;
    }

    public static Boolean verifyUserStatus(UserEntity entity){

        if(entity != null && entity.getUserStatus() != null)
            for(int flag:VALID_USER_STATUS){
                if(flag == entity.getUserStatus()){
                    return true;
                }
            }
        return false;
    }

    /**
     * 过滤绑定100000 的患者信息
     * @param list
     * @return
     */
    public static List<PatientEntity> patientFilter(List<PatientEntity> list){
        return list.stream()
                .filter(item ->(100000 !=  item.getUserBind()))
                .collect(Collectors.toList());
    }
}
